Skip to content

[maven-4.0.x] Fix mvn script expanding ${...} in CLI arguments#12095

Merged
gnodet merged 4 commits into
maven-4.0.xfrom
backport-11983-to-4.0.x
May 20, 2026
Merged

[maven-4.0.x] Fix mvn script expanding ${...} in CLI arguments#12095
gnodet merged 4 commits into
maven-4.0.xfrom
backport-11983-to-4.0.x

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented May 19, 2026

Backport of #11983 to maven-4.0.x.

Fixes the mvn shell script incorrectly expanding ${...} placeholders in CLI arguments. Includes an integration test.

Original author: Gerd Aschemann

Claude Code on behalf of Guillaume Nodet

ascheman and others added 2 commits May 19, 2026 12:01
The eval in the mvn script causes shell expansion of ${...} patterns
in user-provided arguments. Pass user arguments directly via "$@"
instead of concatenating them into the eval string. This preserves
MAVEN_OPTS word splitting while preventing unintended shell expansion.

Fixes #11978

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The eval in the mvn script causes shell expansion of ${...} patterns
in user-provided arguments. This regression test exercises the actual
launcher script via setForkJvm(true) and verifies that ${...} is not
expanded by the shell.

Related: #11978

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gnodet gnodet added this to the 4.0.0-rc-6 milestone May 19, 2026
gnodet and others added 2 commits May 19, 2026 14:52
- Use printf in mvn debug output so each user arg is shown
  individually quoted, preserving boundary information.
- Trim IT Javadoc to match codebase style.
- Reword assertion comments to make primary/secondary priority
  explicit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet merged commit 8f7bdee into maven-4.0.x May 20, 2026
23 checks passed
@gnodet gnodet deleted the backport-11983-to-4.0.x branch May 20, 2026 04:18
@github-actions
Copy link
Copy Markdown

@gnodet Please assign appropriate label to PR according to the type of change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants